﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration.Install;
using System.Diagnostics;
using System.IO;
using System.Linq;


namespace BSDS.Service
{
    [RunInstaller(true)]
    public partial class WatchFolderConfigurationStep : System.Configuration.Install.Installer
    {
        public WatchFolderConfigurationStep()
        {
            InitializeComponent();
        }

        public override void Install(IDictionary stateSaver)
        {
            base.Install(stateSaver);

            var targetDir = Context.Parameters["targetdir"];

            var configuratorDir = Path.Combine(targetDir, "BSDS.Service.Install.Configurator.exe");

            var process = Process.Start(configuratorDir, string.Format("\"{0}\"", targetDir));

            process.WaitForExit();
        }
    }
}
